package com.helloaps.scheduling.domain;

import ai.timefold.solver.core.api.domain.entity.PlanningEntity;
import ai.timefold.solver.core.api.domain.lookup.PlanningId;
import ai.timefold.solver.core.api.domain.variable.PlanningListVariable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.List;

@PlanningEntity
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ProcessStep {
    @PlanningId
    private String id;
    private String code;
    private String name;
    private String no;
    /**
     * TODO 产能先直接挂工序上，后续考虑是资源组还是设备+班次计算
     */
    private BigDecimal capacity;
    private LocalDateTime startDateTime;
    /**
     * 预留时间，模拟用
     * 算出预计开始时间，再往前留出一定的buffer
     * 这个字段具体要加哪还是要看业务，换线/换模/清洗等等逻辑都是类似的道理
     */
    private Duration cleaningDuration;

    @JsonIgnore
    private ProcessRoute processRoute;

    @JsonIgnore
    @PlanningListVariable
    private List<Job> jobs;

    @Override
    public String toString() {
        return name;
    }
}
